import {
  Controller,
  HttpCode,
  HttpStatus,
  Body,
  Query,
  Post,
  Get,
} from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { CommentService } from './comment.service';
import { CommentAddDto } from './dto/comment-add.dto';

@ApiTags('前台评论模块')
@Controller('blog/comment')
export class CommentController {
  constructor(private readonly service: CommentService) {}

  @Post('add')
  @HttpCode(HttpStatus.OK)
  @ApiOperation({ summary: '新增评论' })
  add(@Body() data: CommentAddDto) {
    return this.service.addComment(data);
  }

  @Get('list')
  @HttpCode(HttpStatus.OK)
  @ApiOperation({ summary: '查询评论' })
  queryCommentController(@Query('id') id: number) {
    return this.service.queryCommentList(id);
  }
}
